package com.gimi.cloud.bbp.manage.consumer.feign;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.gimi.cloud.bbp.common.utils.reqhead.Response;
import com.gimi.cloud.bbp.dto.log.LogScheduleJobDTO;
import com.gimi.cloud.bbp.dto.task.ScheduleJobDTO;

import feign.Headers;

/**
 * 定时任务相关Feign
 * @author wbj
 * @version 1.0
 * @Description
 * @create 2018-02-06
 **/
@FeignClient(name = "bbp-time-task-service")
public interface ScheduleJobFeignService {
    /**
     * 获取定时任务列表
     * @param scheduleJobDTO 查询参数
     * @return 获取结果
     */
    @Headers({"Content-Type: application/json","Accept: application/json"})
    @RequestMapping(value = "/task/list", method = RequestMethod.POST)
    Response getTaskList(ScheduleJobDTO scheduleJobDTO);

    /**
     * 获取定时任务信息
     * @param scheduleJobDTO
     * @return 获取结果
     */
    @Headers({"Content-Type: application/json","Accept: application/json"})
    @RequestMapping(value = "/task/info", method = RequestMethod.POST)
    Response getTaskInfo(ScheduleJobDTO scheduleJobDTO);

    /**
     * 添加定时任务
     * @param scheduleJobDTO 待添加的定时任务
     * @return 添加结果
     */
    @Headers({"Content-Type: application/json","Accept: application/json"})
    @RequestMapping(value = "/task/add", method = RequestMethod.POST)
    Response addTask(ScheduleJobDTO scheduleJobDTO);

    /**
     * 更新定时任务
     * @param scheduleJobDTO 待更新的定时任务
     * @return 更新结果
     */
    @Headers({"Content-Type: application/json","Accept: application/json"})
    @RequestMapping(value = "/task/update", method = RequestMethod.POST)
    Response updateTask(ScheduleJobDTO scheduleJobDTO);

    /**
     * 删除定时任务
     * @param scheduleJobDTO 待删除的定时任务
     * @return 删除结果
     */
    @Headers({"Content-Type: application/json","Accept: application/json"})
    @RequestMapping(value = "/task/delete", method = RequestMethod.POST)
    Response deleteTask(ScheduleJobDTO scheduleJobDTO);

    /**
     * 执行定时任务
     * @param scheduleJobDTO 待执行的定时任务
     * @return 执行结果
     */
    @Headers({"Content-Type: application/json","Accept: application/json"})
    @RequestMapping(value = "/task/run", method = RequestMethod.POST)
    Response runTask(ScheduleJobDTO scheduleJobDTO);

    /**
     * 暂停定时任务
     * @param scheduleJobDTO 待暂停的定时任务
     * @return 暂停结果
     */
    @Headers({"Content-Type: application/json","Accept: application/json"})
    @RequestMapping(value = "/task/pause", method = RequestMethod.POST)
    Response pauseTask(ScheduleJobDTO scheduleJobDTO);

    /**
     * 启动定时任务
     * @param scheduleJobDTO 待启动的定时任务
     * @return 启动结果
     */
    @Headers({"Content-Type: application/json","Accept: application/json"})
    @RequestMapping(value = "/task/resume", method = RequestMethod.POST)
    Response resumeTask(ScheduleJobDTO scheduleJobDTO);

    /**
     * 重新持久化定时任务
     * @param scheduleJobDTO 待重新持久化的定时任务
     * @return 重新持久化结果
     */
    @Headers({"Content-Type: application/json","Accept: application/json"})
    @RequestMapping(value = "/task/recreate", method = RequestMethod.POST)
    Response recreateJob(ScheduleJobDTO scheduleJobDTO);


    /**
     * 获取定时任务执行日志
     * @param scheduleJobLogDTO 查询参数
     * @return 查询结果
     */
    @Headers({"Content-Type: application/json","Accept: application/json"})
    @RequestMapping(value = "/task/log/list", method = RequestMethod.POST)
    Response getTaskLogList(LogScheduleJobDTO scheduleJobLogDTO);

}
